package com.hailong.zyt.mapper;

import com.hailong.zyt.beans.Course;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author hailong
 * @since 2021-05-17
 */
public interface CourseMapper extends BaseMapper<Course> {

    /**
     *  查询可选的课程
     * */
    @Select("select * from course c1 " +
            "where c1.cou_id not in (select c2.cou_id from course_all c2 where c2.stu_id = #{stuId}) " +
            "and c1.cou_id not in (select c3.cou_id from course_uncheck c3 where c3.stu_id = #{stuId})")
    List<Course> selectOptionalByStuId(@Param("stuId") Long stuId);

}
